package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.tenant.OpenCompanyTenantSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerTenantAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.tenant.CompanyTenant;
import com.wlyuan.open.scanner.repository.CompanyRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.COMPANY_TENANT)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerCompanyTenantHandler extends BaseScannerHandler<CompanyTenant, OpenCompanyTenantSyncDTO> {
    private final CompanyRepository companyRepository;

    @Override
    protected List<CompanyTenant> select() {
        return companyRepository.companyTenantList();
    }

    @Override
    protected List<OpenCompanyTenantSyncDTO> assembler(List<CompanyTenant> data) {
        return ScannerTenantAssembler.assemble(data);
    }
}
